
///<reference path="../typings/tsd.d.ts" />
module AUTO {
    export class Dialog {
        private _$el: JQuery;
        private _opt: IDialogOption;
        constructor(element: Element, options: IDialogOption|string) {
            this._$el = $(element);
            if (_.isObject(options)) {
            this._opt = $.extend({
                type: 1,
                content: this._$el,
                maxmin: true,//默认最大化
                area: (<IDialogOption>options).width
            }, options);
            var index =layer.open(this._opt);
            this._$el.data("dialogindex", index);
             } else if (_.isString(options)) {
                //目前仅支持close一个命令
                if (options == "close") {
                    layer.close(this._$el.data("dialogindex"));
                }
            }
        }
     }
}